Get a valid integer input from the user in Python